﻿using SalesSys.DAL.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SalesSys.Site.Models
{
    /// <summary>
    /// 订单商品信息模型类
    /// </summary>
    public class CommodityInfoDto
    {
        public Guid Id { get; set; }
        public Guid DepotId { get; set; }
        public Guid CommodityId { get; set; }
        //public Guid DepotCommodityId { get; set; }
        public int Count { get; set; }
        public decimal Price { get; set; }
        /// <summary>
        /// 总重
        /// </summary>
        public decimal Weight { get; set; }

        public decimal SourcePrice { get; set; }
        public decimal SourceWeight { get; set; }
        /// <summary>
        /// 所属订单
        /// </summary>
        public Guid OrderId { get; set; }

        public CommodityInfo ToEntity(CommodityInfo entity = null)
        {
            if (entity == null)
            {
                entity = new CommodityInfo();
            }
            entity.Count = this.Count;
            entity.Price = this.Price;
            entity.Weight = this.Weight;
            entity.SourcePrice = this.SourcePrice;
            entity.SourceWeight = this.SourceWeight;
            return entity;
        }
    }
}